﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DBMigrator.Core.Execution
{
    public class ExecutableMigration : IExecutableMigration
    {
        public DateTime Version { get; private set; }
        public string ConnectionName { get; private set; }
        public IMigration Migration { get; private set; }

        public IExecutableMigration Initialize(MigrationAttribute attribute, Type migration)
        {
            Version = attribute.Version;
            ConnectionName = attribute.ConnectionName;
            Migration = (IMigration) Activator.CreateInstance(migration);
            return this;
        }
    }
}
